/**
 * @param {string} s
 * @param {string} goal
 * @return {boolean}
 */
export var rotateString = function (s, goal) {
  return s.length === goal.length && (s + s).includes(goal)
}

/**
 * @param {string} s
 * @param {string} goal
 * @return {boolean}
 */
export var rotateString2 = function (s, goal) {
  if (s.length !== goal.length) {
    return false
  }
  for (let i = 0; i < s.length; i++) {
    if (s === goal) {
      return true
    }
    s = s.slice(1) + s.slice(0, 1)
  }
  return false
}
